package com.pasu.breakreminder.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class PreferencesHelper {
    public static interface Settings {
        public static interface General {
            String TIME = "settings_time_pref";
            String TIME_IN_MIN = "settings_time_in_min_pref";
            String MESSAGE = "settings_message_pref";
        }

        public interface Notification {
            String ENABLE_FULL_SCREEN_NOTIFICATION = "settings_enable_full_screen_notification_pref";
            String ENABLE_NOTIFICATIONS = "settings_enable_notifications_pref";
            String ENABLE_SOUND = "settings_enable_sound_pref";
            String ENABLE_VIBRATE = "settings_enable_vibrate_pref";
            String ENABLE_LED = "settings_enable_led_pref";
        }

        public interface Other {
            String ENABLE_AUTO_SCHEDULE = "settings_enable_auto_schedule_pref";
            String AUTO_DAYS = "settings_auto_schedule_days_pref";
            String AUTO_FROM_TIME = "settings_auto_schedule_from_pref";
            String AUTO_TO_TIME = "settings_auto_schedule_to_pref";
        }
    }

    public static final String PREF_ALREADY_FIRST_RUN = "pref_already_first_run";
    public static final String PREF_ALARM_STATUS_ON = "pref_alarm_status_on";
    private static SharedPreferences prefs;

    public PreferencesHelper(Context context) {
        prefs = context.getSharedPreferences(context.getPackageName(), Context.MODE_PRIVATE);
    }

    public void save(String preferenceKey, String preferenceValue) {
        Editor e = prefs.edit();
        e.putString(preferenceKey, preferenceValue);
        e.commit();
    }

    public void save(String preferenceKey, int preferenceValue) {
        Editor e = prefs.edit();
        e.putInt(preferenceKey, preferenceValue);
        e.commit();
    }

    public void save(String preferenceKey, boolean preferenceValue) {
        Editor e = prefs.edit();
        e.putBoolean(preferenceKey, preferenceValue);
        e.commit();
    }

    public String getString(String preferenceKey) {
        return prefs.getString(preferenceKey, null);
    }

    public String getString(String preferenceKey, String defValue) {
        return prefs.getString(preferenceKey, defValue);
    }

    public boolean getBoolean(String preferenceKey) {
        return prefs.getBoolean(preferenceKey, false);
    }

    public int getInt(String preferenceKey) {
        return prefs.getInt(preferenceKey, -1);
    }
}
